<template>
  <div class="resumeManagement">
    <Header />
    <div class="image">
      <div class="image-wrap">
        <img src="../../assets/image/fast-reg.png" alt="" />
        <div></div>
      </div>
    </div>
    <p>简历管理</p>
    <div class="resume-table">
      <el-table :data="resumeData" border style="width: 100%" max-height="400">
        <el-table-column prop="rid" label="简历id" width="60" align="center">
        </el-table-column>
        <el-table-column prop="rcompanyName" label="企业名称" width="200" align="center">
        </el-table-column>
        <el-table-column prop="rjobName" label="职位名称" width="150" align="center">
        </el-table-column>
        <el-table-column
          prop="rinfo"
          label="职位信息"
          width="120"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="rimgUrl"
          label="简历缩略图"
          width="200"
          align="center"
        >
        <template slot-scope="scope">
          <div class="demo-image__preview">
            <el-image 
              style="width: 100px; height: 100px"
              :src="scope.row.rimgUrl" 
              :preview-src-list="srcList">
            </el-image>
          </div>
        </template>
        </el-table-column>
        <el-table-column
          prop="ruserName"
          label="简历用户姓名"
          width="100"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="ruserPhone"
          label="简历用户电话"
          width="120"
          align="center"
        >
        </el-table-column>
        <el-table-column label="操作" width="100" align="center">
          <template slot-scope="scope">
            <el-button
              @click="getDeleteResume(scope.row, scope.$index)"
              type="text"
              size="small"
              >删除</el-button
            >
            <el-button
              type="text"
              size="small"
              @click="getPassResume(scope.row, scope.$index)"
              >查看</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import Header from '../../components/Header/index'
export default {
  name: 'resumeManagement',
  components: { Header },
  data() {
    return {
      resumeData: [], // 简历列表
        srcList: []
    }
  },
  computed: {},
  watch: {},
  created() {
    this.getUserData()
  },
  mounted() {},
  methods: {
    // 用户信息
    getUserData() {
      const data = {
        rcompanyName: JSON.parse(sessionStorage.getItem('companyMessage')).cname
      }
      this.$request.post('/api/api/Resume/SelectMoreCompany',data).then((res) => {
        // console.log(res)
        // 深拷贝简历信息
        let resumeData = JSON.parse(JSON.stringify(res.data))
        for (let i = 0; i < res.data.length; i++) {
          resumeData[i].rimgUrl = 'https://resumeurl.oss-cn-shenzhen.aliyuncs.com/imgUrl/' + res.data[i].rimgUrl
          this.srcList[i] = resumeData[i].rimgUrl
        }
        this.resumeData = resumeData.reverse()
        // console.log(this.resumeData);
      })
    },
    // 删除简历
    getDeleteResume(row, index) {
      // console.log(row, index);
      const data = {
        rid: row.rid
      }
      this.$request.post('/api/api/Resume/Del',data).then((res) => {
        // console.log(res)
      this.getUserData()
      })
    },
    // 通过简历
    getPassResume() {},
  },
}
</script>
<style scoped>
.resumeManagement {
  width: 100%;
  height: 100%;
  background-color: #f6f6f8;
  padding-bottom: 20px;
}
.image {
  width: 100%;
  height: 120px;
  background-color: #5dd5cb;
}
.image-wrap {
  width: 1084px;
  margin: auto;
}
.image-wrap img {
  width: 354px;
  height: 120px;
}
.resumeManagement p {
  text-align: center;
  margin: 30px 0;
  font-size: 20px;
}
.resume-table {
  width: 1055px;
  height: 400px;
  margin: auto;
  margin-top: 30px;
  margin-bottom: 40px;
  overflow: scroll;
}
</style>